package com.jade.bss.db;

import com.jade.bss.DbException;
import com.jade.framework.base.criterion.Criteria;
import com.jade.framework.base.util.PagingList;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 2016-4-17
 * Time: 13:50
 * Version : 1.0
 * Remark:
 * History:
 */
public interface JpaBaseDao {
     <T> void delete(Class<T> clazz, Object id) throws DbException;
     <T> void delete(Class<T> clazz, Object[] ids) throws DbException;
     <T> List<T> getAll(Class<T> clazz) throws DbException;
     <T> T getById(Class<T> clazz, Object id) throws DbException;
     <T> List<T> getByIds(Class<T> clazz, Object[] ids) throws DbException;
     void save(Object entity) throws DbException;
     <T> void batchSave(List<T> entitys) throws DbException;
     void update(Object entity) throws DbException;
     int executeBySQL(String sql, Object... params) throws DbException;
     int executeJpql(String jpql, Object... objects) throws DbException;
     <T> List<T> getByJpql(String jpql, Object... objects);
     <T> PagingList<T> queryEntity(Class<T> entityClass, Criteria criteria);
     <T> PagingList<T> queryJoinEntity(String jhpl, Criteria criteria);
    <T> T getEntityByJpql(String jpql, Object... objects);
    <T> PagingList<T> queryEntity(Class<T> entityClass, Criteria criteria, int page, int size, Object entity);
}
